1. Field of the Invention
The present invention relates generally to a motion estimation method using adaptive mode decision and, more particularly, to a method of estimating motion by considering quantization coefficients, the amount of motion vector coding and the amount of texture coding as well as Sum of Absolute Difference values when deciding between inter 1 motion vector mode and inter 4 motion vector mode.
2. Description of the Related Art
In a conventional motion estimation method, when deciding between inter 1 Motion Vector (1MV) mode and inter 4 Motion Vector (4MV) mode, only a Sum of Absolute Difference (SAD) value corresponding to a difference value between a current frame block and a previous frame block is considered with a fixed weight being assigned to the inter 1MV mode. As a result, if there is a relatively large amount of motion at a low bit rate, the inter 4MV mode is decided on. In this case, there occurs a counter result in which the total amount of coding increases because the increase in the amount of motion vector coding is significantly greater than the decrease in the amount of texture coding. In the inter 4MV mode, a relatively large number of motion vectors are generated compared to the inter 1MV mode, so that the decrease in the amount of texture coding is large at a high bit rate. Thus, although the amount of motion vector coding increases, the amount of coding is expected to decrease as a whole. If a quantization coefficient is large (i.e., the decrease in the amount of texture coding is small) or there is a large amount of motion (i.e., the increase in the motion vector is large), there is a problem in that the inter 4MV mode causes a larger amount of coding than the inter 1MV mode.
For example, although Korean Unexamined Pat. Publication No. 2001-0082934 considers the amount of motion vector coding, the consideration is not direct, unlike the present invention. Further, this patent publication attempts to reduce the length of a motion vector difference value in such a way as to select zero vector median predictors when they are smaller than a predetermined threshold. Furthermore, Korean Unexamined Pat. Publication No. 2004-0008360 considers the coding of a motion vector. However, this patent publication considers only the coding length of a motion vector, but does not deal with the amount of texture coding.
The construction and effect of the prior art are described in detail with reference to the accompanying drawings.
FIG. 1 illustrates a process of coding a macro block image (an image processing unit having a 16×16 size) in the conventional Moving Picture Experts Group (MPEG)-4 standard.
Motion Estimation (ME) 10 is the step of finding a motion by comparing the luminous component of a previous frame and the luminous component of a current frame. In this step, the value of a motion vector, indicating the degree of movement from the previous frame, is obtained on a macro block or block (an image processing unit having an 8×8 size) basis. The following steps 11 to 16 are performed on a block basis, and are referred to as texture coding. Texture coding is performed on each of four luminance blocks and two chrominance blocks that are included in one macro block. Motion Compensation minus (MC(−)) 11 is the step of subtracting the pixel value of a previous frame from the pixel value of a current block using the motion vector obtained at the step of ME 10. With this step, only the pixel difference between the previous and current frames remains, and the amount of information to be coded is reduced accordingly. At the step of Discrete Cosine Transform/Quantization (DCT/Q) 12, spatial domain data, having undergone MC(−) 11, are transformed into frequency domain data, and quantization is performed to reduce the amount of information. Alternating Current/Direct Current (AC/DC) Prediction (ADP) 13 is performed only in an intra macro block, and obtains the difference value between the AC/DC coefficients of neighboring blocks. This step has the effect of reducing the amount of coding by reducing spatial redundancy. Variable Length Coding (VLC) 14 is the step of performing variable-length coding on data and generating a final bit stream. Inverse Q/Inverse DCT (IQ/IDCT) 15 and Motion Compensation plus (MC(+)) 16 are the steps of restoring a block image by performing the processes 12 and 11 in an inverse manner, in which case data to be used in a decoder are output as a result of the IQ/IDCT 15 and the MC(+) 16. Since the data are used in the ME 10 of the next frame, the decoder and the encoder can estimate and compensate for motion using the same screen.
FIG. 2 is a flowchart illustrating the steps of a conventional motion estimation method. Macro block-based ME 20 is the step of calculating the SAD values of motion vectors x,y within a motion search range and finding a motion vector having a minimal SAD value. The SAD is defined as the following Equation 1:
                              SAD          ⁡                      (                          x              ,              y                        )                          =                              ∑                          i              =              0                        15                    ⁢                                          ⁢                                    ∑                              j                =                0                            15                        ⁢                                                  ⁢                                                                          C                                      i                    ,                    j                                                  -                                  P                                                            i                      +                      x                                        ,                                          j                      +                      y                                                                                                                                            (        1        )            where Ci,j is the pixel value of a current frame, and Pi,j is the pixel value of a previous frame. It is assumed that the minimal of SAD values output from the macro block-based ME 20 is SADi16. Block-based ME 21 is performed within a range of −2 to +2 around the motion vector that is obtained in macro block-based ME 20 on a block basis. In this case, the SAD is defined as the following Equation 2:
                                                        SAD              ⁡                              (                                  x                  ,                  y                                )                                      =                                          ∑                                  i                  =                  0                                7                            ⁢                                                          ⁢                                                ∑                                      j                    =                    0                                    7                                ⁢                                                                  ⁢                                                                                              C                                              i                        ,                        j                                                              -                                          P                                                                        i                          +                          x                                                ,                                                  j                          +                          y                                                                                                                                                                    ,          or                ⁢                                  ⁢                              mrSAD            ⁡                          (                              x                ,                y                            )                                =                                    ∑                              i                =                0                            7                        ⁢                                                  ⁢                                          ∑                                  j                  =                  0                                7                            ⁢                                                          ⁢                                                                                    (                                                                  C                                                  i                          ,                          j                                                                    -                                              m                        c                                                              )                                    -                                      (                                                                  P                                                                              i                            +                            x                                                    ,                                                      j                            +                            y                                                                                              -                                              m                        p                                                              )                                                                                                      ⁢                                  ⁢                                            m              c                        =                                          1                64                            ⁢                                                ∑                                      i                    =                    0                                    7                                ⁢                                                                  ⁢                                                      ∑                                          j                      =                      0                                        7                                    ⁢                                                                          ⁢                                      C                                          i                      ,                      j                                                                                                    ,                                    m              p                        =                                          1                64                            ⁢                                                ∑                                      i                    =                    0                                    7                                ⁢                                                                  ⁢                                                      ∑                                          j                      =                      0                                        7                                    ⁢                                                                          ⁢                                      P                                                                  i                        +                        x                                            ,                                              j                        +                        y                                                                                                                                                    (        2        )            
Block-based ME 21 is performed on each of four luminance blocks within a macro block. It is assumed that the minimal of SAD values for respective blocks is SADi8—k (k=0, 1, 2, 3). In intra parameter calculation 22, a parameter for determining whether a current macro block will be coded into an intra macro block or an inter macro block is calculated using the following Equations 3 and 4:
                    MB_mean        =                              (                                          ∑                                                      i                    =                    0                                    ,                                      j                    =                    0                                                                    15                  ,                  15                                            ⁢                                                          ⁢                              C                                  i                  ,                  j                                                      )                    /          256                                    (        3        )                                A        =                              ∑                                          i                =                0                            ,                              j                =                0                                                    15              ,              15                                ⁢                                          ⁢                                                                C                                  i                  ,                  j                                            -              MB_mean                                                                      (        4        )            
At step 23, it is determined whether the current macro block will be coded into an intra macro block or an inter macro block using the parameter, and SADi16 and SADi8—k obtained at the steps of the macro block unit ME 20 and the block unit ME 21. When the Equation 5 is true, a condition in which the current macro block will be coded into the intra macro block is fulfilled. The reason why 512 is subtracted from the right side of Equation 5 is that the inter mode, requiring a smaller amount of coding than the intra mode, is generally preferred. The SADinter of Equation 5 is defined by Equation 6. In Equation 6, Min( ) refers to the smaller of the two numbers in parentheses.
                    A        <                  (                                    SAD              inter                        -            512                    )                                    (        5        )                                          SAD          inter                =                  Min          ⁡                      (                                          SAD                                  i                  ⁢                                                                          ⁢                  16                                            ,                                                ∑                                      k                    =                    0                                    3                                ⁢                                                                  ⁢                                  SAD                                      i                    ⁢                                                                                  ⁢                    8                    ⁢                    _k                                                                        )                                              (        6        )            
If the current macro block will be coded into the intra macro block, the motion vector is set to 0 and the step of ME is terminated at step 27. In the case of the inter macro block, the process proceeds to the step of macro block-based semi-pixel ME. Macro block-based semi-pixel ME 24 is the step of calculating the SAD values of the eight semi-pixel motion vectors, including upper, lower, right, left and diagonal semi-pixel motion vectors, of the motion vector obtained from the macro block-based ME 20, and finding a motion vector that has a minimal SAD value. A pixel value at the position of a semi-pixel is replaced with the average value of surrounding integer pixel values. It is assumed that the minimal of the SAD values obtained in the macro block-based semi-pixel ME 24 is SADh16. Block-based semi-pixel ME 25 is the step of calculating SAD values for the eight semi-pixel motion vectors, including upper, lower, right, left and diagonal semi-pixel motion vectors, of the motion vector obtained from the block-based ME 21, and finding a motion vector that has a minimal SAD value. A pixel value at the position of a semi-pixel is replaced with the average value of surrounding integer pixel values. The semi-pixel ME 25 of the block unit is performed on each of four luminance blocks within the macro block. It is assumed that the minimal of SAD values for respective blocks is SADh8—k (k=0, 1, 2, 3). At the step of motion vector decision 26, whether a macro block-based motion vector, an inter 1MV mode block-based motion vector, or an inter 4MV mode block-based motion vector is used is determined using Equation 7. If Equation 7 is true, the block-based motion vector is used. If Equation 7 is false, the macro block-based motion vector is used. The reason why 128 is subtracted from the right side of Equation 7 is that the use of the macro block-based motion vector is preferred (because the amount of motion vector coding is generally smaller). In Equation 7, SAD16 and SAD8—k are defined by Equations 8 and 9, respectively. In Equations 8 and 9, Min( ) refers to the smaller of the two numbers in parentheses.
                                          ∑                          k              =              0                        3                    ⁢                                          ⁢                      SAD                          8              ⁢              _k                                      <                              SAD            16                    -          128                                    (        7        )                                          SAD          16                =                  Min          ⁡                      (                                          SAD                                  i                  ⁢                                                                          ⁢                  16                                            ,                              SAD                                  k                  ⁢                                                                          ⁢                  16                                                      )                                              (        8        )                                          SAD                      8            ⁢            _k                          =                  Min          ⁡                      (                                          SAD                i8_k                            ,                              SAD                k8_k                                      )                                              (        9        )            